package com.twu.biblioteca.model;

public class Movie implements Item {
    private String id;
    private String name;
    private int year;
    private String director;
    private int rating;

    public Movie(String id, String name, int year, String director, int rating) {
        this.id = id;
        this.name = name;
        this.year = year;
        this.director = director;
        this.rating = rating;
    }

    public void printDetails() {
        System.out.println(String.format("%s\t\t\t%s\t\t%s\t%s\t%s", id,name,year,director,rating));
    }

    public String getId() {
        return id;
    }

    @Override
    public boolean isAvailable() {
        return true;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Movie movie = (Movie) o;

        if (!id.equals(movie.id)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }
}
